<?php

@include_once('./database.php');


$id = $_POST['id'];

$obj = [];



$sql = "select * from goods_list where goods_id = $id";

$res = mysqli_query($connect, $sql);

$arr = mysqli_fetch_array($res);

$data = [];

if ($arr) {
    $data['id'] = $arr['goods_id'];
    $data['name'] = $arr['goods_name'];
    $data['title'] = $arr['goods_title'];
    $data['des'] = $arr['goods_des'];
    $data['img'] = $arr['goods_img'];
    $data['price'] = $arr['goods_price'];
    $data['sales'] = $arr['goods_sales'];
    $data['type'] = $arr['goods_type'];


    $obj['status'] = true;
    $obj['msg'] = '数据请求成功';
    $obj['data'] = $data;
} else {
    $obj['status'] = false;
    $obj['msg'] = '服务器错误';
}

echo (json_encode($obj, JSON_UNESCAPED_UNICODE));
